﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using FogBugz.Bridge;
using StickyNotesPrinter.Core;
using StickyNotesPrinter.Specs.FogBugz;

namespace StickyNotesPrinter
{
    /// <summary>
    /// Interaction logic for Main.xaml
    /// </summary>
    public partial class Main
    {
        private ITrackerApi apiTracker;
        public Main()
        {
            InitializeComponent();
            InitializeTracker();
            LoadIterations();
        }

        private void InitializeTracker()
        {
            var apiSettings = new ApiSettings("hernan@sureflix.com","112233","https://sureflix.fogbugz.com/api.asp");
            apiTracker = new Api(apiSettings);
        }

        private void LoadIterations()
        {
            var iterations = apiTracker.GetIterations();
            comboBox1.ItemsSource = iterations;
            comboBox1.DisplayMemberPath = "Name";
        }

        private void button2_Click(object sender, RoutedEventArgs e)
        {
            if (comboBox1.SelectedValue.ToString().Length == 0) return;
            var cases = apiTracker.GetStoriesForIteration((Iteration)comboBox1.SelectedItem);
            listBox1.ItemsSource = cases;
        }

        private void button1_Click(object sender, RoutedEventArgs e)
        {
            var printDialog = new PrintDialog();
            printDialog.ShowDialog();

            buildDocsToPrint();
        }

        private void buildDocsToPrint()
        {
            var run = new Run();
        }
    }
}
